<template>
	<view class="payTransitPage">
		<view class="pay">
			<image class="pay-img" src="/static/ALIPAY.svg" mode="aspectFit"></image>
		</view>

		<view class="hint">
			<view>1.防止微信屏蔽本站链接，找到右上方 <view class="icon"><u-icon name="more-dot-fill" color="#1a1a1a" size="20"></u-icon>
				</view> 的按钮，选择在浏览器中打开；</view>
			<!-- <view style="padding-top: 4px;">2.点击复制本站网址后,使用浏览器访问；</view> -->
		</view>

		<!-- <view class="copy" @click="copy">点此复制网址</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderUrl: null,
				id: null,
			};
		},
		onLoad(options) {
			const decodedUrl = atob(decodeURIComponent(options.url));
			// console.log('完整地址：', decodedUrl);
			// const urlObj = new URL(decodedUrl);
			this.orderUrl = decodedUrl;
			this.id = options.id;
		},
		onShow() {
			this.is_wx();
		},
		methods: {
			is_wx() { // 判断是否在微信环境中
				let that = this;
				let en = window.navigator.userAgent.toLowerCase();
				// 匹配en中是否含有MicroMessenger字符串
				if (en.match(/MicroMessenger/i) == 'micromessenger') {
					return "WeChat";
				}
				if (en.match(/MicroMessenger/i) != 'micromessenger') {
					console.log(this.orderUrl)
					location.href = this.orderUrl;
					return "browser";
				}
			},
			// copy() {
			// 	// 右上角 点击返回
			// 	// 复制网址
			// 	const url = "https://localhost:8080/#/pages/index/materialRequisition/productDetail/productDetail?id=" + this.id;
			// 	uni.setClipboardData({
			// 		data: url, //要被复制的内容
			// 		success: () => { //复制成功的回调函数
			// 			uni.showToast({ //提示
			// 				title: '复制成功'
			// 			})
			// 		}
			// 	});
			// }
		}
	}
</script>

<style lang="scss">
	.payTransitPage {
		display: flex;
		flex-direction: column;
		align-items: center;

		.pay {
			width: 150px;
			height: 75px;
			margin: 40px 0;

			.pay-img {
				width: 100%;
				height: 100%;
			}
		}

		.hint {
			display: flex;
			flex-direction: column;
			color: #888;
			padding: 0 20px;

			.icon {
				display: inline-block;
				padding: 0 4px;
			}
		}

		.copy {
			display: flex;
			justify-content: center;
			text-align: center;
			width: 92%;
			color: white;
			font-size: 16px;
			border-radius: 3px;
			background-color: #0056FF;
			padding: 12px 0;
			margin-top: 40px;
		}
	}
</style>